<template>
  <Modal
    v-model="nbryxzvalue"
    title="添加角色"
    @on-ok="jsxz"
    @on-cancel="cancel"
    width="800px"
  >
    <div class="b">
      <div class="left">
        <Form :model="formValidate3" :rules="ruleValidate3" label-width="80">
          <FormItem label="上级角色" prop="role_pid">
            <Select
              multiple
              v-model="formValidate5.role_pid"
              placeholder="请选择角色"
            >
              <Option value="1">超级管理员</Option>
              <Option value="2">药房管理员</Option>
              <Option value="3">药品录入员</Option>
              <Option value="4">安保人员</Option>
            </Select>
          </FormItem>
          <FormItem label="角色名称" prop="role_name">
            <Input
              v-model="formValidate5.role_name"
              placeholder="请输入角色名称"
            ></Input>
          </FormItem>
          <FormItem label="角色描述" prop="account_phone">
            <Input
              v-model="formValidate5.account_phone"
              placeholder="请输入角色描述"
            ></Input>
          </FormItem>
        </Form>
        <Tree :data="menudata" show-checkbox></Tree>
      </div>
    </div>
  </Modal>
</template>

<script setup>
const menudata = [
  {
    title: "parent 1",
    expand: true,
    children: [
      {
        title: "parent 1-1",
        expand: true,
        children: [
          {
            title: "leaf 1-1-1",
          },
          {
            title: "leaf 1-1-2",
          },
        ],
      },
      {
        title: "parent 1-2",
        expand: true,
        children: [
          {
            title: "leaf 1-2-1",
          },
          {
            title: "leaf 1-2-1",
          },
        ],
      },
    ],
  },
];

const ruleValidate3 = ref({
  user_name: [
    {
      required: true,
      message: "请输入姓名",
      trigger: "blur",
    },
  ],
  user_sex: [
    {
      required: true,
      message: "请输入姓名",
      trigger: "blur",
      type: "change",
    },
  ],

  user_birthday: [
    {
      required: true,
      message: "请输入出生年月",
      trigger: "blur",
      type: "date",
    },
  ],

  org_out_id: [
    {
      required: true,
      message: "请选择所属机构",
      trigger: "change",
    },
  ],
  is_open_account: [
    {
      required: true,
      message: "",
      trigger: "change",
    },
  ],
  user_role_arr: [
    {
      required: true,
      message: "",
      trigger: "blur",
    },
  ],
  account_name: [
    {
      required: true,
      message: "请输入账号名称",
      trigger: "blur",
    },
  ],
  account_pwd: [
    {
      required: true,
      message: "请输入登录密码",
      trigger: "blur",
    },
  ],
  account_pwd_re: [
    {
      required: true,
      message: "请输入重复密码",
      trigger: "blur",
    },
  ],
  account_phone: [
    {
      required: true,
      message: "请输入手机号",
      trigger: "blur",
    },
  ],
  account_mail: [
    {
      required: true,
      message: "请输入格式正确的电子邮箱",
      trigger: "blur",
    },
    { type: "email" },
  ],
});
</script>